# !/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import requests

QINIU = {
    'CHECK_URL': 'http://10.132.23.104:7300/api/check',
    'HOST': '10.132.23.104',
    'PORT': 7300,
    'BUCKET': 'sc-crawler',
}


def check_exist_in_qiniu(file_key):
    check = requests.get(QINIU['CHECK_URL'], {'filename': file_key, 'bucket': QINIU['BUCKET']})
    if check.status_code / 100 != 2:
        return False
    return True


if __name__ == '__main__':
    file_key = sys.argv[1]
    print check_exist_in_qiniu(file_key)
